﻿#pragma once

#include "./HullPolygonModel.h"
#include "pcl/includePcl.h"
#include "../common/BasePclProvider.h"

/// <summary>
/// HullPolygonProvider
/// </summary>
class HullPolygonProvider : public BasePclProvider
{
    Q_OBJECT

public:
    HullPolygonProvider();

public:
    void initEditor(QtTreePropertyBrowser* editor);
    void valueChanged(QtProperty*, double) override;
    void valueChanged(QtProperty*, QString) override;
    void valueChanged(QtProperty*, int) override;
    void valueChanged(QtProperty*, bool) override;
    void valueChanged(QtProperty*, const QColor&) override;
    void close() override;
    void doLoadPcd();
    void doAction();

private:
    /**
     * @brief Construct a concave or convex hull polygon for a plane model
     * https://pcl.readthedocs.io/projects/tutorials/en/master/hull_2d.html
     * data: https://raw.github.com/PointCloudLibrary/data/master/tutorials/table_scene_mug_stereo_textured.pcd
     * @param cloud
     * @return
     */

    void impl(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, HullPolygonModel& model);
};
